package com.jinkaimen.kqb.ui.activity.addmerchant;

import com.ht.baselibs.application.HTApplication;
import com.ht.baselibs.ui.base.BaseWebViewActivity;
import com.ht.baselibs.ui.widget.jsbridge.BridgeHandler;
import com.ht.baselibs.ui.widget.jsbridge.CallBackFunction;
import com.ht.baselibs.utils.ActivityUtils;
import com.ht.baselibs.utils.DeviceUtils;

import java.util.HashMap;
import java.util.Map;

public class WebViewActivity extends BaseWebViewActivity {
    @Override
    protected Map<String, BridgeHandler> getHandlers() {
        Map<String, BridgeHandler> map = new HashMap();


        map.put("getVersionCode", new BridgeHandler() {
            @Override
            public void handler(String data, CallBackFunction function) {
                function.onCallBack(DeviceUtils.getAppVersionCode() + "");
            }
        });

        map.put("isDebugMode", new BridgeHandler() {
            @Override
            public void handler(String data, CallBackFunction function) {
                function.onCallBack(HTApplication.IS_DEBUG_MODE ? "0" : "1");
            }
        });
        map.put("buttons", new BridgeHandler() {
            @Override
            public void handler(String data, CallBackFunction function) {
                ActivityUtils.startActivity(WebViewActivity.this, LoginActivity.class);
            }
        });

        return map;
    }

}